HBase:Shell

您所在的位置:网站首页 hbase status HBase:Shell

HBase:Shell

#HBase:Shell| 来源: 网络整理| 查看: 265

Get row or cell contents; pass table name, row, and optionallya dictionary of column(s), timestamp, timerange and versions. Examples:

 

hbase> get ‘t1’, ‘r1’hbase> get ‘t1’, ‘r1’, {TIMERANGE => [ts1, ts2]}hbase> get ‘t1’, ‘r1’, {COLUMN => ‘c1’}hbase> get ‘t1’, ‘r1’, {COLUMN => [‘c1’, ‘c2’, ‘c3’]}hbase> get ‘t1’, ‘r1’, {COLUMN => ‘c1’, TIMESTAMP => ts1}hbase> get ‘t1’, ‘r1’, {COLUMN => ‘c1’, TIMERANGE => [ts1, ts2], VERSIONS => 4}hbase> get ‘t1’, ‘r1’, {COLUMN => ‘c1’, TIMESTAMP => ts1, VERSIONS => 4}hbase> get ‘t1’, ‘r1’, {FILTER => “ValueFilter(=, ‘binary:abc’)”}hbase> get ‘t1’, ‘r1’, ‘c1’hbase> get ‘t1’, ‘r1’, ‘c1’, ‘c2’hbase> get ‘t1’, ‘r1’, [‘c1’, ‘c2’]

Besides the default ‘toStringBinary’ format, ‘get’ also supports custom formatting bycolumn. A user can define a FORMATTER by adding it to the column name in the getspecification. The FORMATTER can be stipulated:1. either as aorg.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)2. or as a custom class followed by method name: e.g. ‘c(MyFormatterClass).format’.Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:hbase> get ‘t1’, ‘r1’ {COLUMN => [‘cf:qualifier1:toInt’,‘cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt’] }

Note that you can specify a FORMATTER by column only (cf:qualifer). You cannot specifya FORMATTER for all columns of a column family.The same commands also can be run on a reference to a table (obtained via get_table orcreate_table). Suppose you had a reference t to table ‘t1’, the corresponding commandswould be:

hbase> t.get ‘r1’hbase> t.get ‘r1’, {TIMERANGE => [ts1, ts2]}hbase> t.get ‘r1’, {COLUMN => ‘c1’}hbase> t.get ‘r1’, {COLUMN => [‘c1’, ‘c2’, ‘c3’]}hbase> t.get ‘r1’, {COLUMN => ‘c1’, TIMESTAMP => ts1}hbase> t.get ‘r1’, {COLUMN => ‘c1’, TIMERANGE => [ts1, ts2], VERSIONS => 4}hbase> t.get ‘r1’, {COLUMN => ‘c1’, TIMESTAMP => ts1, VERSIONS => 4}hbase> t.get ‘r1’, {FILTER => “ValueFilter(=, ‘binary:abc’)”}hbase> t.get ‘r1’, ‘c1’hbase> t.get ‘r1’, ‘c1’, ‘c2’hbase> t.get ‘r1’, [‘c1’, ‘c2’]



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3